home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / swag / screen.swg / 0060_Screen Segment Info.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-01-27  |  2.5 KB  |  82 lines

  1. {
  2. > I have always addressed $B800 as the screen segment for
  3. > direct video writes in text.... Err, umm, does anyone have
  4. > the code to detect whether it is $B000 or $B800 (for
  5. > Herc.'s and the like)...
  6.  
  7. I know you didn't ask for this, but...
  8.  
  9. If you're on a EGA or better, this code should FORCE the screen segment to be
  10. at whereever you want even if it's a mono mode!
  11.  
  12. BEGIN QUOTE OF CONVERSATION WITH 'NEON PROPHET' WHOEVER THAT IS
  13.  
  14. >>Not sure what you mean here. Do you mean to use A000:0 for
  15. >>both text & graphics if you know it's an e/vga card?
  16. >
  17. >Yes, I mean I want to write to a text screen by accessing memory at
  18. >$A000:0 on an EGA+
  19.  
  20. that's easy..
  21.  
  22. Send a 6 to port 3CEh
  23. then in / out with port 3CFh  (you gotta do this latching). Bitmaped :
  24.         bit  0        Graphics mode = 1
  25.                       Textmode      = 0
  26.         bit  1        Chain Odd Maps To Even Maps  (who knows.. :(  )
  27.         bits 2 - 3    memory map / size
  28.                       00   A000    128k  <-dangerous
  29.                       01   A000    64K   <-ok
  30.                       10   B000    32k
  31.                       11   B800    32k
  32.         bits 4 - 7    Unused
  33.  
  34. a quick note being that I haven't tested using A000 for text.  But I suppose
  35. using   mov ax, 3 / int 10h and then switching this register would work. Never
  36. set the first one if you are using QEMM.  You *WILL* lock up the machine
  37. because it uses some of that space for memory addressing.
  38.  
  39. Example code :
  40.         mov        dx, 3CEH
  41.         mov        al, 06h
  42.         out        dx, al
  43.         inc        dx
  44.         in         al, dx
  45.         and        al, 00001100b
  46.         shr        al, 1
  47.         shr        al, 1
  48. now, the current state of memory should be in AL.
  49.  
  50. Hope this helps.
  51.  
  52. END QUOTE
  53.  
  54. and so do I. Haven't had a chance to try it yet.
  55.  
  56. But this should set up B800 even on a mono system (please let me know if it
  57. works)
  58. }
  59. procedure initB800SegText;begin
  60.  asm mov ax,3; int 10h; end;
  61.  port[$3CE]:=2 or (3 shl 2);
  62.  if port[$3CF]=0 then;   {read to latch}
  63.  end;
  64.  
  65. procedure initA000SegText;begin
  66.  asm mov ax,3; int 10h; end;
  67.  port[$3CE]:=2 or (1 shl 2);
  68.  if port[$3CF]=0 then;   {read to latch}
  69.  end;
  70.  
  71. { this should report the current segment being used. }
  72.  
  73. function segAddr:word;
  74. const table:array[0..3]of word=($A000,$A000,$B000,$B800); begin
  75.  segAddr:=table[(port[$3CF]shr 2)and 3];
  76.  end;
  77.  
  78. {
  79. I don't believe any of these will work on a MDA or CGA, especially not the one
  80. for A000. I don't think they have that register...
  81. }
  82.